CentOS 6
Sponsored Link

Puppet - How to Use [exec resource]
2014/01/26
 
This is the exmaples for exec resource.
It is possible to execute any commands by using exec resource, but it is not recommended because it is critical. So use this resource for specific case like when it receives events by using the refreshonly parameter.
[1] It executes "newaliases" when "/etc/aliases" is updated.
[root@dlp ~]#
vi /etc/puppet/manifests/site.pp
file { '/etc/aliases':
    ensure => file,
    owner  => 'root',
    group  => 'root',
    mode   => 644,
    source => 'puppet://dlp.srv.world/extra_files/aliases'
}

exec { 'newaliases':
    path        => ['/usr/bin', '/usr/sbin'],
    subscribe   => File['/etc/aliases'],
    refreshonly => true
}
 
Tweet